package com.library.dao.impl;

import com.library.dao.IUserDao;
import com.library.entity.User;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by linzhi on 2016/12/12.
 */
@Repository
public class UserDao extends BaseDao<User> implements IUserDao {
    @Override
    public User findByUsername(String username) {
        String hql="from User u where u.username=?";
        List<User> result = this.find(hql, new Object[]{username});
        if (result!=null&&result.size()>0) {
            return result.get(0);
        }
        return null;
    }
}
